<template>
  <div id="app">
             <list class="list">
                        <cell class="cell"  v-for="stationItem in stationItems">
                             <stationInfoItem :stationItem="stationItem"> </stationInfoItem>
                        </cell>
              </list>
    </div>
</template>

<style>
 .loginButton {
       width:460px;
       align-items:center;
       margin-top:50px; 
       background-color:#31A7FE; 
       border:5px solid #F4FCF8; 
       border-radius:15px;
    }


</style>

<script>
     import stationInfoItem from './stationInfoItem.vue'
     var config = require('./config.js')
     var modal = weex.requireModule('modal')
     var stream = weex.requireModule('stream')
     var picker = weex.requireModule('picker')
     var storage = weex.requireModule('storage')


    export default {
        el:'#app', 

        components: { stationInfoItem },
        data () {
          return { 
               natureCodes:['wsclc','dqhj'],
               station:{},
               stationItems:{ },
               nature:"wsclc",
               siteId:"670",
               type:"2011",
               startTime:"",
               endTime:"",
               time:""
      }
    },
   

    methods: {
       
     getItem () {
        storage.getItem('siteId', ret => {
          this.siteId = ret.data;

        });
        storage.getItem('nature', ret => {
          this.nature = ret.data;
        })
      },

      getStationInfo (repo, callback) {
              return stream.fetch({
               method: 'POST',
               type: 'json',
               url: 'http://101.68.88.221:8781/jx/Mobile/' + repo,              
               body:config.toParams({
                        nature:this.nature,
                        siteId:this.siteId,
                        type:this.type,
                        startTime:this.startTime,
                        endTime:this.endTime
                      
      })
           }, callback)
        },
     fetchListData () {
               this.getStationInfo('querySite!getSiteStatisticData.action', res => {

                    if(res.ok){
                        var jsonData = JSON.stringify(res.data,null,4);
                        this.stationItems = res.data.data;
                        this.time = res.data.data[0].time;

                }else{
                    modal.toast({ message: "查询异常"});
                }
         })
      }
        
    },
     created: function(){
          this.getItem();
          this.fetchListData();

        }
  };

</script>